<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<script>
	KindEditor.ready(function(K) {
		window.editor = K.create('#editor_1');
		window.editor = K.create('#editor_2');
		window.editor = K.create('#editor_3');
		window.editor = K.create('#editor_4');
	});
	var teacherDatagrid;
	var selecting=undefined;
	$(function() {
		teacherDatagrid = $('#teacherDatagrid')
				.datagrid(
						{
							url:'<%=request.getContextPath()%>/getInfo',
							pagination : true,
							singleSelect : true,
							sortName : 'id',
							sortOrder : 'asc',
							fit : true,
							fitColumns : true,
							columns : [ [
									{
										field : 'StudentName',
										title : '学生姓名',
										width : 50,
										sortable : true,
									},
									{
										field : 'dissName',
										title : '论文名',
										width : 300
									},
									{
										field : 'dissStateOfExamination',
										title : '论文状态',
										width : 100,
										formatter:function(value,row,index){
											if(value==""||value==null||value=="A")
												return '未审核';
											else if(value=="B")
												return '指导教师审核未通过';
											else if(value=="C")
												return '指导教师审核通过';
											else if(value=="D")
												return '专业负责人审核未通过';
											else if(value=="E")
												return '专业负责人审核通过';
										}
									},
									{
										field : 'btn',
										title : '操作',
										width : 100,
										formatter : function(value, row, index) {
											return	'<a id="'+index+'" onclick="down('+index+')">下载</a>'+
											'&nbsp;&nbsp;<button  onclick="wordShow(\''+row["dissOpenReportURL"]+'\')">在线查看</button>';
										}
									} ] ],
							onLoadSuccess : function(data) {
								$('.linkbutton').linkbutton({
									text : '编辑',
									plain : true,
									iconCls : 'icon-edit'
								});
							},
							onSelect:function(rowIndex, rowData){
								selecting=rowData["id"];
							},
							onUnselect:function(rowIndex, rowData){
								selecting=undefined;
							},
							onClickRow:function(rowIndex, rowData){
							/*$.post("<%=request.getContextPath()%>/selectStu",{
							'id':rowData["id"]},function(r){
							},'json');*/
							}
						});
		down = function(i) {
		
			var rows=teacherDatagrid.datagrid('getRows');
			document.getElementById(i).href = "<%=request.getContextPath()%>/downLoad?URL="
					+ rows[i].dissOpenReportURL+"&type=4";
			console.info(document.getElementById(i).href);
		},

		$('#wordShow').dialog({
			width : 650,
			height : 850,
			modal : true,
			closed:true
		});

		wordShow = function(URL) {
			$.post("<%=request.getContextPath()%>/word2swf",{'URL':URL},function(r){
			console.info($('#wordShow'));
			$('#wordShow').dialog('open');
			$('#wordShow').window('refresh', '<%=request.getContextPath()%>/flexpaper/readFile.jsp');
			},'json');
		}
		
		
		pass=function(i)
		{
			if(selecting==undefined)
			{
				$.messager.alert('提示','请选择学生','info');
			}
			else
			{
				if(i==0)
				{
					$.post("<%=request.getContextPath()%>/openPass?pass=no",{'id':selecting},function(r){
								document.location.reload();	
								},'json');
				}
				else
				{
					$.post("<%=request.getContextPath()%>/openPass?pass=yes",{'id':selecting},function(r){
								document.location.reload();	
								},'json');
				}
			}
			
		}
		
		submitMsg=function()
		{
			if(selecting==undefined)
			{
				$.messager.alert('提示','请选择学生','info');
			}
			else
			$.post("<%=request.getContextPath()%>/setMessage", {
					'id' : selecting,
					'teacherMessage' : $('#teacherMessage').val()
				}, function(r) {
					location.reload();
				}, 'json');
		}

	});
	function showWhat()
		{
			var collap=document.getElementById('collapseHelp');
			if(collap.style.display=='none')
				collap.style.display='block';
			else
				collap.style.display='none';
		}
</script>
<style>
.col-xs-3 {
	padding: 1px;
	height: 686px;
}

.col-xs-9 {
	height: 686px;
}

.container {
	width: 1280px !important;
}

.xs11 {
	margin-top: 20px;
	margin-left: 30px;
}

#right {
	position: absolute;
	right: 30px;
	width: 300px;
}

#xs12 {
	height: 580px;
	width: 313px;
}

#xs13 {
	height: 202px;
	width: 900px
}

#xs11 {
	height: 140px;
}

#xs10 {
	height: 110px;
}

#xs1 {
	height: 100px;
	width: 80px;
}

body {
	font-size: 12px;
}

ul {
	margin: 0;
	padding: 7px;
}

ul li {
	height: 22px;
	vertical-align: bottom;
}

.actived {
	height: 40px;
	border-top: 3px solid #ff9900;;
	border-right: 1px solid #AAC7E9;
	border-left: 1px solid #AAC7E9;
	border-bottom: 1px solid #AAC7E9;
	background: #FFDAB9;
}

.panel-group {
	padding: 1px;
	margin：1px;
}
</style>

<div class="row">
	<div class="col-xs-4  xs11">
		<strong><font size="3">流程管理》审核开题报告</font>
		</strong>
	</div>
	<div class="col-xs-7 xs11" id="right">
		<p>
			<b><font size="3">毕业设计流转状态：&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;开题阶段
		</p>
		</b></font>

	</div>
</div>
<div id="wordShow"></div>  
<div class="col-xs-11  xs11">
	<div class="panel panel-default">
		<div class="panel-heading" align="left">
			<a data-toggle="collapse" data-parent="#accordion"
				href="#collapseHelp" class="glyphicon glyphicon-chevron-down" onclick="showWhat()">
				操作指南 </a>
		</div>
		<div id="collapseHelp" class="panel-collapse collapse">
			<div class="panel-body">
				操作指南 —— 毕业论文开题报告
				<ul>
					<li>论文开题报告提交后，需等待指导教授审核，只有审核通过后，才算完成开题</li>
					<br>
					<li>如果论文中包含大量的数学公式，请以附件的方式上传开题报告</li>
				</ul>
			</div>
		</div>
	</div>

	<div style="width:100%;height:200px;">
		<div style="width:100%;height:200px;">

			<table id="teacherDatagrid"></table>
		</div>
	</div>

	<div class="row">
		<div class="col-lg-12 col-sm-12 col-md-12" align="center">
			<p align="center">
				<b><font size="4">吉林大学珠海学院毕业论文（设计）开题报告
			</p>
			</b></font> <br>

			<hr />
		</div>


		<div class="col-xs-12" align="center">
			<button type="button" class="btn btn-success" onclick="pass(1)">审核通过</button>
			&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
			<button type="button" class="btn btn-danger" onclick="pass(0)">审核不通过</button>
		</div>
		</b>
		</p>
		<div class="col-xs-12">
			<p align="left">
				<b>指导教师意见:</b>
			</p>
			<textarea class="form-control" rows="2" name="teacherMessage"
				id="teacherMessage">指导教师意见：（对论文难度、工作量、进度安排和工作条件进行说明）</textarea>
			<button class="btn btn-primary" onclick="submitMsg()">提交</button>
		</div>
	</div>
</div>